//
//  CJBaseTableViewCell.m
//  CoJellyCartoon
//
//  Created by dllo on 16/3/30.
//  Copyright © 2016年 CJG. All rights reserved.
//

#import "CJBaseTableViewCell.h"

@implementation CJBaseTableViewCell
//- (void)dealloc
//{
//    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"ChangeColor" object:nil];
//}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        if ([[[NSUserDefaults standardUserDefaults]objectForKey:@"NightMode"] isEqualToString:@"Night"]) {
            
            self.backgroundColor = [UIColor lightGrayColor];
            
        }else{
            self.backgroundColor = [UIColor whiteColor];
        }
        
        //接收通知
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColorOne:) name:@"ChangeColor" object:nil];
        
    }
    
    return self;
}

- (void)changeColorOne:(NSNotification *)notifition{
    
    if ([[[NSUserDefaults standardUserDefaults]objectForKey:@"NightMode"] isEqualToString:@"Night"]) {
        
        self.backgroundColor = [UIColor lightGrayColor];
        
    }else{
        
        self.backgroundColor = [UIColor whiteColor];
    }
    
    
}
@end
